package com.yidu.service.serviceImpl;

import com.yidu.entity.UserRole;
import com.yidu.mapper.UserRoleMapper;
import com.yidu.mapper.UsersMapper;
import com.yidu.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UserRoleServiceImpl implements UserRoleService {
    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public List<UserRole> selectUserRole(int page, int limit) {
        Map map = new HashMap();
        map.put("page",(page-1)*limit);
        map.put("limit",(page-1)*limit+limit);
        return userRoleMapper.selectUserRole(map);
    }

    @Override
    public void insertUserRole(UserRole userRole) {
        userRoleMapper.insertUserRole(userRole);
    }

    @Override
    public void updateUserRole(UserRole userRole) {
        userRoleMapper.updateUserRole(userRole);
    }

    @Override
    public void deleteUserRole(int userRoleId) {
        userRoleMapper.deleteUserRole(userRoleId);
    }
}
